package com.eve.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
@EnableBinding(Sink.class)              // 区别消费者和生产者，绑定信道
public class ReceiveController {
	
	@Value("${server.port}")
	private String serverPort;
	
	@StreamListener(Sink.INPUT)
	public void input(Message<String> message) {
		System.out.println("监听接收的消息->" + message.getPayload());
		System.out.println("端口：" + serverPort);
	}
	
}
